home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 2 / Atari Mega Archive CD - Volume 2.iso / 8bit / cislib_a / bsio.4th < prev    next >
Text File  |  1995-04-22  |  6KB  |  49 lines

  1. \ 30 -BSIO documentation     dlm17jul83  ;s                                     The following screens add several new        
  2. words to FORTH.  These words are:                                                 -BSIO......This word replaces -DISC as     
  3. the fundamental disk I/O word in FORTH. It adds the ability to handle double    density (256 byte) sectors and the           
  4. ability to write with-out verify.         USE-BSIO...This word installs -BSIO   as the disk I/O word, all words that         
  5. call -DISC now will call -BSIO.           USE-DISC...This word installs -DISC   as the disk I/O word, it undoes the          
  6. change that USE-BSIO made.                DOUBLE.....Sets FORTH up in double    density mode, all systems constants are      
  7. changed to the values needed for double density screens.  It also sets D1 to    double density operation.                    
  8.                                                                                                                              
  9. \ 31 DOC continued           dlm17jul83  ;s                                       SINGLE.....This word resets all FORTH      
  10. constants back to their single density  values.  It also switches D1 to single  density.                                     
  11.   VERIFY.....Sets write with verify.      NO.VERIFY..Sets write without verify.   CHK.DRIVE..Checks the configuration        
  12. of the drive whose number is on the     stack.                                    SET.DRIVE..Reconfigures the drive          
  13. whose number is on the stack.  The      variable DENSITY controls the density   the drive will be set to.                    
  14.                                           The constant C/BUF should be set to   either 120 (single) or 240 (double) in       
  15. pns-FORTH, in val-FORTH the values should be 128 and 256.  If you have val-FORTHyou should change SINGLE and DOUBLE to       
  16. set the different values into the       constant.                                                                            
  17. \ 32 -BSIO, single or double dlm20nov82 hex    57 variable WCMND \ type of write        1 variable DENSITY                   
  18. code -BSIO \ <adr, sec, dr#, fl>---<flg> 0 ,x lda, 0= not \ read or write          if,   52 #  lda, 40 # ldy,                
  19.    else, wcmnd lda, 80 # ldy,              then, 302   sta, 303  sty,            1 # lda, 301 sta, \ set the unit # to 1     
  20.  2 ,x lda, \ get drive # and compute the clc, 30 # adc, 300 sta, \ device id     4 ,x lda, 30a sta, 5 ,x lda, 30b sta,       
  21.  6 ,x lda, 304 sta, 7 ,x lda, 305 sta,   density lda, 1 # cmp, 0=                  if,   80 # lda, 00 # ldy, \ single        
  22.    else, 00 # lda, 01 # ldy, \ double      then, 308  sta, 309  sty,             0f # lda, 306 sta, \ time out value         
  23.  xsave stx, e459 jsr, 0< \ error?          if, 303 lda, else, 00 # lda,            then, xsave ldx, 6 ,x sta,                
  24.  00 # lda, 7 ,x sta, inx, inx,           poptwo jmp,                            end-code decimal -->                         
  25. \ 33 Percom disk control     dlm12sep82  hex                                                                                 
  26. code SIO \ <>---<>                        xsave stx, e459 jsr, xsave ldx,         next jmp,                                  
  27. end-code                                                                        12 c-array BUFF                              
  28.                                         : SET.CALL \ <drive #>---<>               30 + 300 c! \ set SIO unit number          
  29.   0 buff 304 ! 1 30a ! c 308 ! ;                                                : READ.DRIVE  \ <drive #>---<>               
  30.   set.call 4e 302 c! \ Read drive table   40 303 c! sio ;                                                                    
  31. : WRITE.DRIVE \ <drive #>---<>            set.call 4f 302 c! \ Write drive table  80 303 c! sio ;                            
  32.                                          decimal -->                                                                         
  33. \ 34 Percom disk control     dlm04sep82                                          : CHK.DRIVE \ <drive #>---<>                
  34.    read.drive                              0 buff c@ 4 .r ."  tracks"        cr    1 buff  @ 4 .r ."  step rate"     cr      
  35.    3 buff c@ 4 .r ."  sectors/track" cr    4 buff c@ 5 spaces                        if ." double" else ." single" then      
  36.      ."  sided" cr                         5 buff c@ 5 spaces                        if ." double" else ." single" then      
  37.      ."  density" cr                       6 buff c@ 256 * 7 buff c@ + 4 .r          ."  bytes/sector"  cr ;                 
  38.                                          : SET.DRIVE \ <drive #>---<>              dup read.drive density @ 1 = if           
  39.      0 5 buff c! 32768 6 buff ! ( SD )     else                                      4 5 buff c!     1 6 buff ! ( DD )       
  40.    then write.drive ;                    -->                                                                                 
  41. \ 35 -BSIO, control words    dlm02sep82                                         : VERIFY    87 wcmnd ! ;                     
  42. : NO.VERIFY 80 wcmnd ! ;                                                        \ assume drive number one                    
  43.                                         : SINGLE \ Set single density operation     8 ' b/scr ! 128 ' b/buf   !              
  44.   120 ' c/buf !   1   density !             1 set.drive   4   buffers ;                                                      
  45. : DOUBLE \ set double density operation     4 ' b/scr ! 256 ' b/buf   !           240 ' c/buf !   2   density !              
  46.     1 set.drive   4   buffers ;                                                 : USE-BSIO                                   
  47.   ' -bsio [ ' -disc cfa ] literal ! ;                                           : USE-DISC                                   
  48.   ' -disc [ ' -disc cfa ] literal ! ;                                            ;s                                          
  49.